# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=wxWidgets

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.0.1
pkgrel=1
pkgdesc="A C++ library that lets developers create applications for Windows, Linux and UNIX (mingw-w64)"
arch=('any')
license=("custom:wxWindows")
groups=("${MINGW_PACKAGE_PREFIX}")
url="http://www.wxwidgets.org/"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
        "${MINGW_PACKAGE_PREFIX}-zlib"
        "${MINGW_PACKAGE_PREFIX}-xz"
        "${MINGW_PACKAGE_PREFIX}-expat"
        "${MINGW_PACKAGE_PREFIX}-libpng"
        "${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
        "${MINGW_PACKAGE_PREFIX}-libtiff"
        "${MINGW_PACKAGE_PREFIX}-cppunit")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-python2")
options=('strip' 'staticlibs' 'buildflags')
source=(http://downloads.sourceforge.net/wxwindows/wxWidgets-${pkgver}.tar.bz2
        "wxWidgets-3.0.0-gcc-codelight.patch")
sha1sums=('73e58521d6871c9f4d1e7974c6e3a81629fddcf8'
          '05a3471dcf735d86defe0df00dcb8e9ff0698290')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/wxWidgets-3.0.0-gcc-codelight.patch
}

build() {
  [[ -d ${srcdir}/build-${CARCH} ]] && rm -rf ${srcdir}/build-${CARCH}
  mkdir -p ${srcdir}/build-${CARCH} && cd ${srcdir}/build-${CARCH}
  #CPPFLAGS+=" -fno-keep-inline-dllexport"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --with-msw \
    --disable-mslu \
    --enable-shared \
    --enable-iniconf \
    --enable-iff \
    --enable-permissive \
    --disable-monolithic \
    --enable-unicode \
    --enable-accessibility \
    --disable-precomp-headers
  make VERBOSE=1
}

package() {
  cd ${srcdir}/build-${CARCH}
  make DESTDIR="${pkgdir}" install

  mv ${pkgdir}${MINGW_PREFIX}/lib/*.dll ${pkgdir}${MINGW_PREFIX}/bin
}
